/**
 *Project: jh-plugins
 *File: cn.xkshow.plugins.page.Pages.java 
 *Author: hardy(admin@xkshow.cn) Copyright
 ****************************************************************
 *   VERSION       DATE            BY       CHANGE/COMMENT
 * --------------------------------------------------------------
 *    1.0        2013-7-12         hardy         create
 ****************************************************************
 *note:
 ***************************************************************/
package cn.xkshow.plugins.page;

public class Page {
	
	int perPageNum = 10;//The amount of data per
	long dtotal = -1L;//Total number of data
	int cpage = 1;//Current page
	
	int dindex = 0;//The current page data index
	int tpage = 1;//Total page

	String pgurl = ""; //page url

	public void executeCalculate() {
		this.tpage = (int) Math.ceil((this.dtotal + this.perPageNum - 1L)
				/ this.perPageNum);
		this.dindex = ((this.cpage>this.tpage?1:this.cpage - 1) * this.perPageNum);
	}
	
	public Page() {
	}

	public long getDtotal() {
		return dtotal;
	}

	public void setDtotal(long dtotal) {
		this.dtotal = dtotal;
	}

	public int getPerPageNum() {
		return perPageNum;
	}

	public void setPerPageNum(int perPageNum) {
		this.perPageNum = perPageNum;
	}

	public int getCpage() {
		return cpage;
	}

	public void setCpage(int cpage) {
		this.cpage = cpage;
	}

	public int getTpage() {
		return tpage;
	}

	public void setTpage(int tpage) {
		this.tpage = tpage;
	}

	public String getPgurl() {
		return pgurl;
	}

	public void setPgurl(String pgurl) {
		this.pgurl = pgurl;
	}

	public int getDindex() {
		return dindex;
	}

	public void setDindex(int dindex) {
		this.dindex = dindex;
	}

	
}
